package db.pojo;

import java.util.*;
import java.text.SimpleDateFormat;
import db.ext.EajdbcmonitorExt;
@SuppressWarnings("unchecked")
/**
 * eajdbcmonitor
 */
public class Eajdbcmonitor {
	/**
	 * MONITORID
	 */
	public long mONITORID;
	/**
	 * SQLTEXT
	 */
	public String sQLTEXT;
	/**
	 * STARTTIME
	 */
	public long sTARTTIME;
	/**
	 * COSTTIME
	 */
	public int cOSTTIME;
	/**
	 * EFFECTROWS
	 */
	public int eFFECTROWS;
	/**
	 * TYPE
	 */
	public String tYPE;
	SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static EajdbcmonitorExt DB = new EajdbcmonitorExt(); 
	
	public Eajdbcmonitor() {
		super();
	}
	
	public Eajdbcmonitor(long mONITORID, String sQLTEXT, long sTARTTIME, int cOSTTIME, int eFFECTROWS, String tYPE) {
		super();
		this.mONITORID = mONITORID; 
		this.sQLTEXT = sQLTEXT; 
		this.sTARTTIME = sTARTTIME; 
		this.cOSTTIME = cOSTTIME; 
		this.eFFECTROWS = eFFECTROWS; 
		this.tYPE = tYPE; 
	}
	
	public long getMONITORID() {
		return mONITORID;
	}

	public void setMONITORID(long mONITORID) {
		this.mONITORID = mONITORID;
	} 
	
	public void changeMONITORIDWith(long mONITORID){
		this.mONITORID += mONITORID;
	}
	
	public void changeMONITORIDWithMin(long mONITORID,long min){
		this.mONITORID += mONITORID;
		this.mONITORID = this.mONITORID < min ? min : this.mONITORID;
	}
	
	public void changeMONITORIDWithMax(long mONITORID,long max){
		this.mONITORID += mONITORID;
		this.mONITORID = this.mONITORID > max ? max : this.mONITORID;
	}
	
	public void changeMONITORIDWithMaxMin(long mONITORID,long max,long min){
		this.mONITORID += mONITORID;
		this.mONITORID = this.mONITORID < min ? min : this.mONITORID;
		this.mONITORID = this.mONITORID > max ? max : this.mONITORID;
	}	
	public String getSQLTEXT() {
		return sQLTEXT;
	}

	public void setSQLTEXT(String sQLTEXT) {
		this.sQLTEXT = sQLTEXT;
	} 
	
	public long getSTARTTIME() {
		return sTARTTIME;
	}

	public void setSTARTTIME(long sTARTTIME) {
		this.sTARTTIME = sTARTTIME;
	} 
	
	public void changeSTARTTIMEWith(long sTARTTIME){
		this.sTARTTIME += sTARTTIME;
	}
	
	public void changeSTARTTIMEWithMin(long sTARTTIME,long min){
		this.sTARTTIME += sTARTTIME;
		this.sTARTTIME = this.sTARTTIME < min ? min : this.sTARTTIME;
	}
	
	public void changeSTARTTIMEWithMax(long sTARTTIME,long max){
		this.sTARTTIME += sTARTTIME;
		this.sTARTTIME = this.sTARTTIME > max ? max : this.sTARTTIME;
	}
	
	public void changeSTARTTIMEWithMaxMin(long sTARTTIME,long max,long min){
		this.sTARTTIME += sTARTTIME;
		this.sTARTTIME = this.sTARTTIME < min ? min : this.sTARTTIME;
		this.sTARTTIME = this.sTARTTIME > max ? max : this.sTARTTIME;
	}	
	public int getCOSTTIME() {
		return cOSTTIME;
	}

	public void setCOSTTIME(int cOSTTIME) {
		this.cOSTTIME = cOSTTIME;
	} 
	
	public void changeCOSTTIMEWith(int cOSTTIME){
		this.cOSTTIME += cOSTTIME;
	}
	
	public void changeCOSTTIMEWithMin(int cOSTTIME,int min){
		this.cOSTTIME += cOSTTIME;
		this.cOSTTIME = this.cOSTTIME < min ? min : this.cOSTTIME;
	}
	
	public void changeCOSTTIMEWithMax(int cOSTTIME,int max){
		this.cOSTTIME += cOSTTIME;
		this.cOSTTIME = this.cOSTTIME > max ? max : this.cOSTTIME;
	}
	
	public void changeCOSTTIMEWithMaxMin(int cOSTTIME,int max,int min){
		this.cOSTTIME += cOSTTIME;
		this.cOSTTIME = this.cOSTTIME < min ? min : this.cOSTTIME;
		this.cOSTTIME = this.cOSTTIME > max ? max : this.cOSTTIME;
	}	
	public int getEFFECTROWS() {
		return eFFECTROWS;
	}

	public void setEFFECTROWS(int eFFECTROWS) {
		this.eFFECTROWS = eFFECTROWS;
	} 
	
	public void changeEFFECTROWSWith(int eFFECTROWS){
		this.eFFECTROWS += eFFECTROWS;
	}
	
	public void changeEFFECTROWSWithMin(int eFFECTROWS,int min){
		this.eFFECTROWS += eFFECTROWS;
		this.eFFECTROWS = this.eFFECTROWS < min ? min : this.eFFECTROWS;
	}
	
	public void changeEFFECTROWSWithMax(int eFFECTROWS,int max){
		this.eFFECTROWS += eFFECTROWS;
		this.eFFECTROWS = this.eFFECTROWS > max ? max : this.eFFECTROWS;
	}
	
	public void changeEFFECTROWSWithMaxMin(int eFFECTROWS,int max,int min){
		this.eFFECTROWS += eFFECTROWS;
		this.eFFECTROWS = this.eFFECTROWS < min ? min : this.eFFECTROWS;
		this.eFFECTROWS = this.eFFECTROWS > max ? max : this.eFFECTROWS;
	}	
	public String getTYPE() {
		return tYPE;
	}

	public void setTYPE(String tYPE) {
		this.tYPE = tYPE;
	} 
	
	
	public Map eajdbcmonitorToMap() {
		Map map = new HashMap();
		try {
			map.put("mONITORID",this.mONITORID);
			map.put("sQLTEXT",this.sQLTEXT);
			map.put("sTARTTIME",this.sTARTTIME);
			map.put("cOSTTIME",this.cOSTTIME);
			map.put("eFFECTROWS",this.eFFECTROWS);
			map.put("tYPE",this.tYPE);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return map;
	}

	public Eajdbcmonitor mapToEajdbcmonitor(Map map){
		try {
			long mONITORID = Long.parseLong( map.get("mONITORID").toString());
			String sQLTEXT =  map.get("sQLTEXT").toString();
			long sTARTTIME = Long.parseLong( map.get("sTARTTIME").toString());
			int cOSTTIME = Integer.parseInt( map.get("cOSTTIME").toString());
			int eFFECTROWS = Integer.parseInt( map.get("eFFECTROWS").toString());
			String tYPE =  map.get("tYPE").toString();
			Eajdbcmonitor eajdbcmonitor = new Eajdbcmonitor(mONITORID, sQLTEXT, sTARTTIME, cOSTTIME, eFFECTROWS, tYPE);
			return eajdbcmonitor;
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		}
	} 
	
	public String toString(){
		return eajdbcmonitorToMap().toString();
	}
	
	//方便数据操作	
	public Eajdbcmonitor insert(){
		return DB.insert(this);
	}
	public Eajdbcmonitor update(){
		return DB.update(this);
	}
	
	public int delete(){
		return DB.delete(this);
	}
	
}
